<table>
    <thead>
        <tr>
            <th>科目</th>
            @for($i = 0; $i < 12; $i++)
            <th>{{$i+1}}月</th>
            @endfor
            <th>合计</th>
            <th>会员卡期末余额</th>
        </tr>
    </thead>
    <tbody>
<!--    会员充值    -->
        <tr>
            <td>会员卡充值</td>
            @for($i = 0; $i < 12; $i ++)
            <td>{{isset($recharge[$i+1])?$recharge[$i+1]->sum('price'):0}}</td>
            @endfor
            <td>{{$sumRecharge}}</td>
        </tr>
<!--    充值赠送    -->
        <tr>
            <td>充值赠送</td>
            @for($i = 0; $i < 12; $i ++)
            <td>{{isset($giving[$i+1])?$giving[$i+1]->sum('price'):0}}</td>
            @endfor
            <td>{{$sumGiving}}</td>
        </tr>
<!--    月消费金额    -->
        <tr>
            <td>月消费金额</td>
            @for($i = 0; $i < 12; $i ++)
            <td>{{isset($balance[$i+1])?$balance[$i+1]->sum('price'):0}}</td>
            @endfor
            <td>{{$sumBalance}}</td>
            <td>{{$sumRecharge+$sumGiving-$sumBalance}}</td>
        </tr>
    </tbody>
</table>